/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package app.model_package;

import java.util.ArrayList;

/**
 *
 * @author haythem
 */
public class CausalityRelationSetCouple {

    private ArrayList<String> listOfFollowed ;
    private ArrayList<String> listOfFollowers ;

    public CausalityRelationSetCouple(ArrayList<String> listOfFollowed, ArrayList<String> listOfFollowers) {
        this.listOfFollowed = listOfFollowed;
        this.listOfFollowers = listOfFollowers;
    }

    public CausalityRelationSetCouple() {
        listOfFollowed = new ArrayList<String>();
        listOfFollowers = new ArrayList<String>();
    }

    public ArrayList<String> getListOfFollowed() {
        return listOfFollowed;
    }

    public void setListOfFollowed(ArrayList<String> listOfFollowed) {
        this.listOfFollowed = listOfFollowed;
    }

    public ArrayList<String> getListOfFollowers() {
        return listOfFollowers;
    }

    public void setListOfFollowers(ArrayList<String> listOfFollowers) {
        this.listOfFollowers = listOfFollowers;
    }

    public void addFollowedTask(String task){
        this.listOfFollowed.add(task);
    }

    public void addFollowerTask(String task){
        this.listOfFollowers.add(task);
    }

    /**
     * this method checks if the task f exists already in the list
     * of the followed tasks
     * @param f
     * @return : true if it contains and false if not
     */
    public boolean containsFollowed(String f){
        return listOfFollowed.contains((String) f);
    }


    /**
     * this method checks if the task f exists already in the list
     * of the follower tasks
     * @param f
     * @return : true if it contains and false if not
     */
    public boolean containsFollower(String f){
        return listOfFollowers.contains((String) f);
    }


    public String toString(){
        String s= "{ ";
        for (int i=0;i<this.listOfFollowed.size()-1;i++){
            s+=this.listOfFollowed.get(i)+", ";
        }
        s+=this.listOfFollowed.get(this.listOfFollowed.size()-1);
        s+= "} , { ";
        for (int i=0;i<this.listOfFollowers.size()-1;i++){
            s+=this.listOfFollowers.get(i)+", ";
        }
        s+=this.listOfFollowers.get(this.listOfFollowers.size()-1);
        s+= "}";
        return s;
    }
}
